#pragma once 

#include <string>
using namespace std;

#include "pqxx/pqxx"
using namespace pqxx;

namespace topdbs
{
	struct PqxCursor
	{
		string m_sql;
		string m_cursor_name;
		pqxx::result*  m_resultset;	
		pqxx::connection* m_connection_ptr;

		pqxx::transaction_base& m_trans;

		pqxx::stateless_cursor<pqxx::cursor_base::read_only, pqxx::cursor_base::owned>* m_cursor;
		pqxx::prepare::invocation*  m_stmt;

		int m_dataindex;
		int m_cur_dataindex;

		PqxCursor(pqxx::transaction_base& trans,const string& sSQL,const string& cursor_name,bool isHold);
		~PqxCursor();
	};

	struct PqxStream 
	{
		pqxx::result*  m_resultset;	
		pqxx::connection* m_connection_ptr;
		PqxStream();
		~PqxStream();
	};

	struct PqxStatement
	{
		string m_prepare_name;
		pqxx::prepare::invocation*  m_stmt;
		pqxx::result*  m_resultset;
		pqxx::connection* m_connection_ptr;
		int m_dataindex;
		PqxStatement(pqxx::connection* connection_ptr,pqxx::transaction_base& trans,const string& statement);
		~PqxStatement();
	};

}
